﻿using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x02000068 RID: 104
public static class MMD4MecanimData
{
	// Token: 0x060002F6 RID: 758 RVA: 0x000181C0 File Offset: 0x000163C0
	private static bool _Decl(ref int index, int max)
	{
		if (index < max)
		{
			return true;
		}
		index -= max;
		return false;
	}

	// Token: 0x060002F7 RID: 759 RVA: 0x000181D3 File Offset: 0x000163D3
	public static MMD4MecanimData.FullBodyIKGroup GetFullBodyIKGroup(int fullBodyIKTargetIndex)
	{
		return MMD4MecanimData.GetFullBodyIKGroup(ref fullBodyIKTargetIndex);
	}

	// Token: 0x060002F8 RID: 760 RVA: 0x000181DC File Offset: 0x000163DC
	public static MMD4MecanimData.FullBodyIKGroup GetFullBodyIKGroup(ref int fullBodyIKTargetIndex)
	{
		if (fullBodyIKTargetIndex >= 0 && fullBodyIKTargetIndex < 36)
		{
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 2))
			{
				return MMD4MecanimData.FullBodyIKGroup.Body;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.LeftArm;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.RightArm;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.LeftLeg;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.RightLeg;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.LeftWristFinger;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 5))
			{
				return MMD4MecanimData.FullBodyIKGroup.RightWristFinger;
			}
			if (MMD4MecanimData._Decl(ref fullBodyIKTargetIndex, 4))
			{
				return MMD4MecanimData.FullBodyIKGroup.Look;
			}
		}
		return MMD4MecanimData.FullBodyIKGroup.Unknown;
	}

	// Token: 0x060002F9 RID: 761 RVA: 0x0001826C File Offset: 0x0001646C
	public static string GetFullBodyIKTargetName(int fullBodyIKTargetIndex)
	{
		MMD4MecanimData.FullBodyIKGroup fullBodyIKGroup;
		return MMD4MecanimData.GetFullBodyIKTargetName(out fullBodyIKGroup, fullBodyIKTargetIndex);
	}

	// Token: 0x060002FA RID: 762 RVA: 0x00018284 File Offset: 0x00016484
	public static string GetFullBodyIKTargetName(out MMD4MecanimData.FullBodyIKGroup fullBodyIKGroup, int fullBodyIKTargetIndex)
	{
		fullBodyIKGroup = MMD4MecanimData.FullBodyIKGroup.Unknown;
		if (fullBodyIKTargetIndex >= 0 && fullBodyIKTargetIndex < 36)
		{
			fullBodyIKGroup = MMD4MecanimData.GetFullBodyIKGroup(ref fullBodyIKTargetIndex);
			switch (fullBodyIKGroup)
			{
			case MMD4MecanimData.FullBodyIKGroup.Body:
			{
				MMD4MecanimData.FullBodyIKBodyTarget fullBodyIKBodyTarget = (MMD4MecanimData.FullBodyIKBodyTarget)fullBodyIKTargetIndex;
				return fullBodyIKBodyTarget.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.LeftArm:
			{
				MMD4MecanimData.FullBodyIKArmTarget fullBodyIKArmTarget = (MMD4MecanimData.FullBodyIKArmTarget)fullBodyIKTargetIndex;
				return fullBodyIKArmTarget.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.RightArm:
			{
				MMD4MecanimData.FullBodyIKArmTarget fullBodyIKArmTarget2 = (MMD4MecanimData.FullBodyIKArmTarget)fullBodyIKTargetIndex;
				return fullBodyIKArmTarget2.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.LeftLeg:
			{
				MMD4MecanimData.FullBodyIKLegTarget fullBodyIKLegTarget = (MMD4MecanimData.FullBodyIKLegTarget)fullBodyIKTargetIndex;
				return fullBodyIKLegTarget.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.RightLeg:
			{
				MMD4MecanimData.FullBodyIKLegTarget fullBodyIKLegTarget2 = (MMD4MecanimData.FullBodyIKLegTarget)fullBodyIKTargetIndex;
				return fullBodyIKLegTarget2.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.LeftWristFinger:
			{
				MMD4MecanimData.FullBodyIKFingerTarget fullBodyIKFingerTarget = (MMD4MecanimData.FullBodyIKFingerTarget)fullBodyIKTargetIndex;
				return fullBodyIKFingerTarget.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.RightWristFinger:
			{
				MMD4MecanimData.FullBodyIKFingerTarget fullBodyIKFingerTarget2 = (MMD4MecanimData.FullBodyIKFingerTarget)fullBodyIKTargetIndex;
				return fullBodyIKFingerTarget2.ToString();
			}
			case MMD4MecanimData.FullBodyIKGroup.Look:
			{
				MMD4MecanimData.FullBodyIKLookTarget fullBodyIKLookTarget = (MMD4MecanimData.FullBodyIKLookTarget)fullBodyIKTargetIndex;
				return fullBodyIKLookTarget.ToString();
			}
			}
		}
		return string.Empty;
	}

	// Token: 0x060002FB RID: 763 RVA: 0x00018364 File Offset: 0x00016564
	public static MMD4MecanimData.ModelData BuildModelData(TextAsset modelFile)
	{
		if (modelFile == null)
		{
			Debug.LogError("BuildModelData: modelFile is norhing.");
			return null;
		}
		byte[] bytes = modelFile.bytes;
		if (bytes == null || bytes.Length == 0)
		{
			Debug.LogError("BuildModelData: Nothing modelBytes.");
			return null;
		}
		MMD4MecanimCommon.BinaryReader binaryReader = new MMD4MecanimCommon.BinaryReader(bytes);
		if (!binaryReader.Preparse())
		{
			Debug.LogError("BuildModelData:modelFile is unsupported fomart.");
			return null;
		}
		MMD4MecanimData.ModelData modelData = new MMD4MecanimData.ModelData();
		binaryReader.BeginHeader();
		modelData.fileType = (MMD4MecanimData.FileType)binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderFloat();
		binaryReader.ReadHeaderInt();
		modelData.modelAdditionalFlags = (MMD4MecanimData.ModelAdditionalFlags)binaryReader.ReadHeaderInt();
		modelData.vertexCount = binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderInt();
		modelData.vertexScale = binaryReader.ReadHeaderFloat();
		modelData.importScale = binaryReader.ReadHeaderFloat();
		binaryReader.EndHeader();
		int structListLength = binaryReader.structListLength;
		for (int i = 0; i < structListLength; i++)
		{
			if (!binaryReader.BeginStructList())
			{
				Debug.LogError("BuildModelData: Parse error.");
				return null;
			}
			int currentStructFourCC = binaryReader.currentStructFourCC;
			if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("BONE"))
			{
				if (!MMD4MecanimData._ParseBoneData(modelData, binaryReader))
				{
					Debug.LogError("BuildModelData: Parse error.");
					return null;
				}
			}
			else if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("IK__"))
			{
				if (!MMD4MecanimData._ParseIKData(modelData, binaryReader))
				{
					Debug.LogError("BuildModelData: Parse error.");
					return null;
				}
			}
			else if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("MRPH"))
			{
				if (!MMD4MecanimData._ParseMorphData(modelData, binaryReader))
				{
					Debug.LogError("BuildModelData: Parse error.");
					return null;
				}
			}
			else if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("RGBD"))
			{
				if (!MMD4MecanimData._ParseRigidBodyData(modelData, binaryReader))
				{
					Debug.LogError("BuildModelData: Parse error.");
					return null;
				}
			}
			else if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("JOIN") && !MMD4MecanimData._ParseJointData(modelData, binaryReader))
			{
				Debug.LogError("BuildModelData: Parse error.");
				return null;
			}
			if (!binaryReader.EndStructList())
			{
				Debug.LogError("BuildModelData: Parse error.");
				return null;
			}
		}
		return modelData;
	}

	// Token: 0x060002FC RID: 764 RVA: 0x00018564 File Offset: 0x00016764
	private static bool _ParseBoneData(MMD4MecanimData.ModelData modelData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		modelData.boneDataDictionary = new Dictionary<string, int>();
		modelData.boneDataList = new MMD4MecanimData.BoneData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.BoneData boneData = new MMD4MecanimData.BoneData();
			boneData.boneAdditionalFlags = (MMD4MecanimData.BoneAdditionalFlags)binaryReader.ReadStructInt();
			boneData.nameJp = binaryReader.GetName(binaryReader.ReadStructInt());
			binaryReader.ReadStructInt();
			boneData.skeletonName = binaryReader.GetName(binaryReader.ReadStructInt());
			boneData.parentBoneID = binaryReader.ReadStructInt();
			boneData.sortedBoneID = binaryReader.ReadStructInt();
			binaryReader.ReadStructInt();
			boneData.originalParentBoneID = binaryReader.ReadStructInt();
			boneData.originalSortedBoneID = binaryReader.ReadStructInt();
			boneData.baseOrigin = binaryReader.ReadStructVector3();
			boneData.baseOrigin.x = -boneData.baseOrigin.x;
			boneData.baseOrigin.z = -boneData.baseOrigin.z;
			if (modelData.fileType == MMD4MecanimData.FileType.PMD)
			{
				boneData.pmdBoneType = (MMD4MecanimData.PMDBoneType)binaryReader.ReadStructInt();
				boneData.childBoneID = binaryReader.ReadStructInt();
				boneData.targetBoneID = binaryReader.ReadStructInt();
				boneData.followCoef = binaryReader.ReadStructFloat();
			}
			else if (modelData.fileType == MMD4MecanimData.FileType.PMX)
			{
				boneData.transformLayerID = binaryReader.ReadStructInt();
				boneData.pmxBoneFlags = (MMD4MecanimData.PMXBoneFlags)binaryReader.ReadStructInt();
				boneData.inherenceParentBoneID = binaryReader.ReadStructInt();
				boneData.inherenceWeight = binaryReader.ReadStructFloat();
				boneData.externalID = binaryReader.ReadStructInt();
			}
			if (!binaryReader.EndStruct())
			{
				return false;
			}
			modelData.boneDataList[i] = boneData;
			if (!string.IsNullOrEmpty(boneData.skeletonName))
			{
				modelData.boneDataDictionary[boneData.skeletonName] = i;
			}
		}
		return true;
	}

	// Token: 0x060002FD RID: 765 RVA: 0x00018721 File Offset: 0x00016921
	private static Vector3 _ToDegree(Vector3 radian)
	{
		return new Vector3(radian.x * 57.29578f, radian.y * 57.29578f, radian.z * 57.29578f);
	}

	// Token: 0x060002FE RID: 766 RVA: 0x00018750 File Offset: 0x00016950
	private static bool _ParseIKData(MMD4MecanimData.ModelData modelData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		modelData.ikDataList = new MMD4MecanimData.IKData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.IKData ikdata = new MMD4MecanimData.IKData();
			ikdata.ikAdditionalFlags = (MMD4MecanimData.IKAdditionalFlags)binaryReader.ReadStructInt();
			ikdata.destBoneID = binaryReader.ReadStructInt();
			ikdata.targetBoneID = binaryReader.ReadStructInt();
			ikdata.iteration = binaryReader.ReadStructInt();
			ikdata.angleConstraint = binaryReader.ReadStructFloat();
			int num = binaryReader.ReadStructInt();
			ikdata.ikLinkDataList = new MMD4MecanimData.IKLinkData[num];
			for (int j = 0; j < num; j++)
			{
				MMD4MecanimData.IKLinkData iklinkData = new MMD4MecanimData.IKLinkData();
				iklinkData.ikLinkBoneID = binaryReader.ReadInt();
				iklinkData.ikLinkFlags = (MMD4MecanimData.IKLinkFlags)binaryReader.ReadInt();
				if ((iklinkData.ikLinkFlags & MMD4MecanimData.IKLinkFlags.HasAngleJoint) != MMD4MecanimData.IKLinkFlags.None)
				{
					Vector3 lowerLimit = binaryReader.ReadVector3();
					Vector3 upperLimit = binaryReader.ReadVector3();
					iklinkData.lowerLimit = lowerLimit;
					iklinkData.upperLimit = upperLimit;
					iklinkData.lowerLimit = new Vector3(-upperLimit[0], lowerLimit[1], -upperLimit[2]);
					iklinkData.upperLimit = new Vector3(-lowerLimit[0], upperLimit[1], -lowerLimit[2]);
					iklinkData.lowerLimitAsDegree = MMD4MecanimData._ToDegree(iklinkData.lowerLimit);
					iklinkData.upperLimitAsDegree = MMD4MecanimData._ToDegree(iklinkData.upperLimit);
				}
				ikdata.ikLinkDataList[j] = iklinkData;
			}
			if (!binaryReader.EndStruct())
			{
				return false;
			}
			modelData.ikDataList[i] = ikdata;
		}
		return true;
	}

	// Token: 0x060002FF RID: 767 RVA: 0x000188E0 File Offset: 0x00016AE0
	private static bool _ParseMorphData(MMD4MecanimData.ModelData modelData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		modelData.morphDataDictionaryJp = new Dictionary<string, int>();
		modelData.morphDataDictionaryEn = new Dictionary<string, int>();
		if (modelData.isMorphTranslateName)
		{
			modelData.translatedMorphDataDictionary = new Dictionary<string, int>();
		}
		modelData.morphDataList = new MMD4MecanimData.MorphData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.MorphData morphData = new MMD4MecanimData.MorphData();
			int num = binaryReader.ReadStructInt();
			int index = binaryReader.ReadStructInt();
			int index2 = binaryReader.ReadStructInt();
			int morphCategory = binaryReader.ReadStructInt();
			int num2 = binaryReader.ReadStructInt();
			int num3 = binaryReader.ReadStructInt();
			int index3 = binaryReader.ReadStructInt();
			morphData.nameJp = binaryReader.GetName(index);
			morphData.nameEn = binaryReader.GetName(index2);
			if (modelData.isMorphTranslateName)
			{
				morphData.translatedName = binaryReader.GetName(index3);
			}
			morphData.morphCategory = (MMD4MecanimData.MorphCategory)morphCategory;
			morphData.morphType = (MMD4MecanimData.MorphType)num2;
			if ((num & 1) != 0)
			{
				morphData.isMorphBaseVertex = true;
			}
			if (num2 != 1)
			{
				if (num2 != 0)
				{
					if (num2 == 8)
					{
						morphData.materialData = new MMD4MecanimData.MorphMaterialData[num3];
						for (int j = 0; j < num3; j++)
						{
							MMD4MecanimData.MorphMaterialData morphMaterialData = default(MMD4MecanimData.MorphMaterialData);
							morphMaterialData.materialID = binaryReader.ReadInt();
							morphMaterialData.operation = (MMD4MecanimData.MorphMaterialOperation)binaryReader.ReadInt();
							morphMaterialData.diffuse = binaryReader.ReadColor();
							morphMaterialData.specular = binaryReader.ReadColorRGB();
							morphMaterialData.shininess = binaryReader.ReadFloat();
							morphMaterialData.ambient = binaryReader.ReadColorRGB();
							morphMaterialData.edgeColor = binaryReader.ReadColor();
							morphMaterialData.edgeSize = binaryReader.ReadFloat();
							morphMaterialData.textureColor = binaryReader.ReadColor();
							morphMaterialData.sphereColor = binaryReader.ReadColor();
							morphMaterialData.toonTextureColor = binaryReader.ReadColor();
							if (morphMaterialData.operation == MMD4MecanimData.MorphMaterialOperation.Adding)
							{
								morphMaterialData.specular.a = 0f;
								morphMaterialData.ambient.a = 0f;
							}
							morphData.materialData[j] = morphMaterialData;
						}
					}
				}
				else
				{
					morphData.indices = new int[num3];
					morphData.weights = new float[num3];
					for (int k = 0; k < num3; k++)
					{
						morphData.indices[k] = binaryReader.ReadInt();
						morphData.weights[k] = binaryReader.ReadFloat();
					}
				}
			}
			if (!binaryReader.EndStruct())
			{
				return false;
			}
			modelData.morphDataList[i] = morphData;
			if (!string.IsNullOrEmpty(morphData.nameJp))
			{
				modelData.morphDataDictionaryJp[morphData.nameJp] = i;
			}
			if (!string.IsNullOrEmpty(morphData.nameEn))
			{
				modelData.morphDataDictionaryEn[morphData.nameEn] = i;
			}
			if (modelData.isMorphTranslateName && !string.IsNullOrEmpty(morphData.translatedName))
			{
				modelData.translatedMorphDataDictionary[morphData.translatedName] = i;
			}
		}
		return true;
	}

	// Token: 0x06000300 RID: 768 RVA: 0x00018BE0 File Offset: 0x00016DE0
	private static bool _ParseRigidBodyData(MMD4MecanimData.ModelData modelData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		modelData.rigidBodyDataList = new MMD4MecanimData.RigidBodyData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.RigidBodyData rigidBodyData = new MMD4MecanimData.RigidBodyData();
			int rigidBodyAdditionalFlags = binaryReader.ReadStructInt();
			rigidBodyData.nameJp = binaryReader.GetName(binaryReader.ReadStructInt());
			rigidBodyData.nameEn = binaryReader.GetName(binaryReader.ReadStructInt());
			rigidBodyData.boneID = binaryReader.ReadStructInt();
			rigidBodyData.collisionGroupID = binaryReader.ReadStructInt();
			rigidBodyData.collisionMask = binaryReader.ReadStructInt();
			rigidBodyData.shapeType = (MMD4MecanimData.ShapeType)binaryReader.ReadStructInt();
			rigidBodyData.rigidBodyType = (MMD4MecanimData.RigidBodyType)binaryReader.ReadStructInt();
			rigidBodyData.shapeSize = binaryReader.ReadStructVector3();
			rigidBodyData.position = binaryReader.ReadStructVector3();
			rigidBodyData.rotation = binaryReader.ReadStructVector3();
			rigidBodyData.mass = binaryReader.ReadStructFloat();
			rigidBodyData.linearDamping = binaryReader.ReadStructFloat();
			rigidBodyData.angularDamping = binaryReader.ReadStructFloat();
			rigidBodyData.restitution = binaryReader.ReadStructFloat();
			rigidBodyData.friction = binaryReader.ReadStructFloat();
			rigidBodyData.rigidBodyAdditionalFlags = (MMD4MecanimData.RigidBodyAdditionalFlags)rigidBodyAdditionalFlags;
			modelData.rigidBodyDataList[i] = rigidBodyData;
			if (!binaryReader.EndStruct())
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x06000301 RID: 769 RVA: 0x00018D10 File Offset: 0x00016F10
	private static bool _ParseJointData(MMD4MecanimData.ModelData modelData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		modelData.jointDataList = new MMD4MecanimData.JointData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.JointData jointData = new MMD4MecanimData.JointData();
			binaryReader.ReadStructInt();
			binaryReader.ReadStructInt();
			binaryReader.ReadStructInt();
			binaryReader.ReadStructInt();
			jointData.rigidBodyIDA = binaryReader.ReadStructInt();
			jointData.rigidBodyIDB = binaryReader.ReadStructInt();
			modelData.jointDataList[i] = jointData;
			if (!binaryReader.EndStruct())
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x06000302 RID: 770 RVA: 0x00018DA4 File Offset: 0x00016FA4
	public static MMD4MecanimData.ExtraData BuildExtraData(TextAsset extraFile)
	{
		if (extraFile == null)
		{
			Debug.LogError("BuildExtraData: extraFile is norhing.");
			return null;
		}
		byte[] bytes = extraFile.bytes;
		if (bytes == null || bytes.Length == 0)
		{
			Debug.LogError("BuildModelData: Nothing extraBytes.");
			return null;
		}
		MMD4MecanimCommon.BinaryReader binaryReader = new MMD4MecanimCommon.BinaryReader(bytes);
		if (!binaryReader.Preparse())
		{
			Debug.LogError("BuildModelData:extraFile is unsupported fomart.");
			return null;
		}
		MMD4MecanimData.ExtraData extraData = new MMD4MecanimData.ExtraData();
		binaryReader.BeginHeader();
		binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderFloat();
		binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderInt();
		extraData.vertexCount = binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderInt();
		extraData.vertexScale = binaryReader.ReadHeaderFloat();
		extraData.importScale = binaryReader.ReadHeaderFloat();
		binaryReader.EndHeader();
		int structListLength = binaryReader.structListLength;
		for (int i = 0; i < structListLength; i++)
		{
			if (!binaryReader.BeginStructList())
			{
				Debug.LogError("BuildExtraData: Parse error.");
				return null;
			}
			int currentStructFourCC = binaryReader.currentStructFourCC;
			if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("VTX_") && !MMD4MecanimData._ParseVertexData(extraData, binaryReader))
			{
				Debug.LogError("BuildExtraData: Parse error.");
				return null;
			}
			if (!binaryReader.EndStructList())
			{
				Debug.LogError("BuildExtraData: Parse error.");
				return null;
			}
		}
		return extraData;
	}

	// Token: 0x06000303 RID: 771 RVA: 0x00018EE0 File Offset: 0x000170E0
	private static bool _ParseVertexData(MMD4MecanimData.ExtraData extraData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		extraData.vertexDataList = new MMD4MecanimData.VertexData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.VertexData vertexData = default(MMD4MecanimData.VertexData);
			vertexData.flags = (MMD4MecanimData.VertexFlags)binaryReader.ReadStructInt();
			vertexData.position = binaryReader.ReadStructVector3();
			vertexData.normal = binaryReader.ReadStructVector3();
			vertexData.uv = binaryReader.ReadStructVector2();
			vertexData.edgeScale = binaryReader.ReadStructFloat();
			vertexData.boneTransform = (MMD4MecanimData.BoneTransform)binaryReader.ReadStructByte();
			vertexData.boneWeight = default(BoneWeight);
			switch (vertexData.boneTransform)
			{
			case MMD4MecanimData.BoneTransform.BDEF1:
				vertexData.boneWeight.boneIndex0 = binaryReader.ReadInt();
				vertexData.boneWeight.weight0 = 1f;
				break;
			case MMD4MecanimData.BoneTransform.BDEF2:
			case MMD4MecanimData.BoneTransform.SDEF:
				vertexData.boneWeight.boneIndex0 = binaryReader.ReadInt();
				vertexData.boneWeight.boneIndex1 = binaryReader.ReadInt();
				vertexData.boneWeight.weight0 = binaryReader.ReadFloat();
				vertexData.boneWeight.weight1 = 1f - vertexData.boneWeight.weight0;
				break;
			case MMD4MecanimData.BoneTransform.BDEF4:
			case MMD4MecanimData.BoneTransform.QDEF:
				vertexData.boneWeight.boneIndex0 = binaryReader.ReadInt();
				vertexData.boneWeight.boneIndex1 = binaryReader.ReadInt();
				vertexData.boneWeight.boneIndex2 = binaryReader.ReadInt();
				vertexData.boneWeight.boneIndex3 = binaryReader.ReadInt();
				vertexData.boneWeight.weight0 = binaryReader.ReadFloat();
				vertexData.boneWeight.weight1 = binaryReader.ReadFloat();
				vertexData.boneWeight.weight2 = binaryReader.ReadFloat();
				vertexData.boneWeight.weight3 = binaryReader.ReadFloat();
				break;
			}
			if (vertexData.boneTransform == MMD4MecanimData.BoneTransform.SDEF)
			{
				vertexData.sdefC = binaryReader.ReadVector3();
				vertexData.sdefR0 = binaryReader.ReadVector3();
				vertexData.sdefR1 = binaryReader.ReadVector3();
			}
			if (!binaryReader.EndStruct())
			{
				return false;
			}
			extraData.vertexDataList[i] = vertexData;
		}
		return true;
	}

	// Token: 0x06000304 RID: 772 RVA: 0x0001911C File Offset: 0x0001731C
	public static MMD4MecanimData.AnimData BuildAnimData(TextAsset animFile)
	{
		if (animFile == null)
		{
			Debug.LogError("BuildAnimData: animFile is norhing.");
			return null;
		}
		byte[] bytes = animFile.bytes;
		if (bytes == null || bytes.Length == 0)
		{
			Debug.LogError("BuildAnimData: Nothing animBytes.");
			return null;
		}
		MMD4MecanimCommon.BinaryReader binaryReader = new MMD4MecanimCommon.BinaryReader(bytes);
		if (!binaryReader.Preparse())
		{
			Debug.LogError("BuildAnimData:animFile is unsupported fomart.");
			return null;
		}
		MMD4MecanimData.AnimData animData = new MMD4MecanimData.AnimData();
		binaryReader.BeginHeader();
		binaryReader.ReadHeaderInt();
		binaryReader.ReadHeaderInt();
		animData.maxFrame = binaryReader.ReadHeaderInt();
		binaryReader.EndHeader();
		int structListLength = binaryReader.structListLength;
		for (int i = 0; i < structListLength; i++)
		{
			if (!binaryReader.BeginStructList())
			{
				Debug.LogError("BuildAnimData: Parse error.");
				return null;
			}
			int currentStructFourCC = binaryReader.currentStructFourCC;
			if (currentStructFourCC == MMD4MecanimCommon.BinaryReader.MakeFourCC("MRPH") && !MMD4MecanimData._ParseMorphMotionData(animData, binaryReader))
			{
				Debug.LogError("BuildAnimData: Parse error.");
				return null;
			}
			if (!binaryReader.EndStructList())
			{
				Debug.LogError("BuildAnimData: Parse error.");
				return null;
			}
		}
		return animData;
	}

	// Token: 0x06000305 RID: 773 RVA: 0x0001922C File Offset: 0x0001742C
	private static bool _ParseMorphMotionData(MMD4MecanimData.AnimData animData, MMD4MecanimCommon.BinaryReader binaryReader)
	{
		animData.morphMotionDataList = new MMD4MecanimData.MorphMotionData[binaryReader.currentStructLength];
		for (int i = 0; i < binaryReader.currentStructLength; i++)
		{
			if (!binaryReader.BeginStruct())
			{
				return false;
			}
			MMD4MecanimData.MorphMotionData morphMotionData = new MMD4MecanimData.MorphMotionData();
			binaryReader.ReadStructInt();
			morphMotionData.name = binaryReader.GetName(binaryReader.ReadStructInt());
			int num = binaryReader.ReadStructInt();
			if (num < 0)
			{
				return false;
			}
			morphMotionData.frameNos = new int[num];
			morphMotionData.f_frameNos = new float[num];
			morphMotionData.weights = new float[num];
			for (int j = 0; j < num; j++)
			{
				morphMotionData.frameNos[j] = binaryReader.ReadInt();
				morphMotionData.weights[j] = binaryReader.ReadFloat();
				morphMotionData.f_frameNos[j] = (float)morphMotionData.frameNos[j];
			}
			animData.morphMotionDataList[i] = morphMotionData;
			if (!binaryReader.EndStruct())
			{
				return false;
			}
		}
		return true;
	}

	// Token: 0x04000375 RID: 885
	public const int FullBodyIKTransformElements = 4;

	// Token: 0x04000376 RID: 886
	public const int FullBodyIKTargetMax = 36;

	// Token: 0x02000069 RID: 105
	public enum FileType
	{
		// Token: 0x04000378 RID: 888
		None,
		// Token: 0x04000379 RID: 889
		PMD,
		// Token: 0x0400037A RID: 890
		PMX
	}

	// Token: 0x0200006A RID: 106
	public enum MorphCategory
	{
		// Token: 0x0400037C RID: 892
		Base,
		// Token: 0x0400037D RID: 893
		EyeBrow,
		// Token: 0x0400037E RID: 894
		Eye,
		// Token: 0x0400037F RID: 895
		Lip,
		// Token: 0x04000380 RID: 896
		Other,
		// Token: 0x04000381 RID: 897
		Max
	}

	// Token: 0x0200006B RID: 107
	public enum ShapeType
	{
		// Token: 0x04000383 RID: 899
		Sphere,
		// Token: 0x04000384 RID: 900
		Box,
		// Token: 0x04000385 RID: 901
		Capsule
	}

	// Token: 0x0200006C RID: 108
	public enum RigidBodyType
	{
		// Token: 0x04000387 RID: 903
		Kinematics,
		// Token: 0x04000388 RID: 904
		Simulated,
		// Token: 0x04000389 RID: 905
		SimulatedAligned
	}

	// Token: 0x0200006D RID: 109
	public enum BoneTransform
	{
		// Token: 0x0400038B RID: 907
		Unknown = -1,
		// Token: 0x0400038C RID: 908
		BDEF1,
		// Token: 0x0400038D RID: 909
		BDEF2,
		// Token: 0x0400038E RID: 910
		BDEF4,
		// Token: 0x0400038F RID: 911
		SDEF,
		// Token: 0x04000390 RID: 912
		QDEF
	}

	// Token: 0x0200006E RID: 110
	public enum MorphType
	{
		// Token: 0x04000392 RID: 914
		Group,
		// Token: 0x04000393 RID: 915
		Vertex,
		// Token: 0x04000394 RID: 916
		Bone,
		// Token: 0x04000395 RID: 917
		UV,
		// Token: 0x04000396 RID: 918
		UVA1,
		// Token: 0x04000397 RID: 919
		UVA2,
		// Token: 0x04000398 RID: 920
		UVA3,
		// Token: 0x04000399 RID: 921
		UVA4,
		// Token: 0x0400039A RID: 922
		Material
	}

	// Token: 0x0200006F RID: 111
	public enum FullBodyIKGroup
	{
		// Token: 0x0400039C RID: 924
		Body,
		// Token: 0x0400039D RID: 925
		LeftArm,
		// Token: 0x0400039E RID: 926
		RightArm,
		// Token: 0x0400039F RID: 927
		LeftLeg,
		// Token: 0x040003A0 RID: 928
		RightLeg,
		// Token: 0x040003A1 RID: 929
		LeftWristFinger,
		// Token: 0x040003A2 RID: 930
		RightWristFinger,
		// Token: 0x040003A3 RID: 931
		Look,
		// Token: 0x040003A4 RID: 932
		Max,
		// Token: 0x040003A5 RID: 933
		Unknown = -1
	}

	// Token: 0x02000070 RID: 112
	public enum FullBodyIKBodyTarget
	{
		// Token: 0x040003A7 RID: 935
		Torso,
		// Token: 0x040003A8 RID: 936
		Neck,
		// Token: 0x040003A9 RID: 937
		Max
	}

	// Token: 0x02000071 RID: 113
	public enum FullBodyIKArmTarget
	{
		// Token: 0x040003AB RID: 939
		Arm,
		// Token: 0x040003AC RID: 940
		Elbow,
		// Token: 0x040003AD RID: 941
		Wrist,
		// Token: 0x040003AE RID: 942
		WristUpward,
		// Token: 0x040003AF RID: 943
		WristForward,
		// Token: 0x040003B0 RID: 944
		Max
	}

	// Token: 0x02000072 RID: 114
	public enum FullBodyIKLegTarget
	{
		// Token: 0x040003B2 RID: 946
		Hip,
		// Token: 0x040003B3 RID: 947
		Knee,
		// Token: 0x040003B4 RID: 948
		Foot,
		// Token: 0x040003B5 RID: 949
		FootUpward,
		// Token: 0x040003B6 RID: 950
		FootForward,
		// Token: 0x040003B7 RID: 951
		Max
	}

	// Token: 0x02000073 RID: 115
	public enum FullBodyIKFingerTarget
	{
		// Token: 0x040003B9 RID: 953
		Thumb,
		// Token: 0x040003BA RID: 954
		Index,
		// Token: 0x040003BB RID: 955
		Middle,
		// Token: 0x040003BC RID: 956
		Ring,
		// Token: 0x040003BD RID: 957
		Little,
		// Token: 0x040003BE RID: 958
		Max
	}

	// Token: 0x02000074 RID: 116
	public enum FullBodyIKLookTarget
	{
		// Token: 0x040003C0 RID: 960
		Head,
		// Token: 0x040003C1 RID: 961
		HeadUpward,
		// Token: 0x040003C2 RID: 962
		HeadForward,
		// Token: 0x040003C3 RID: 963
		Eyes,
		// Token: 0x040003C4 RID: 964
		Max
	}

	// Token: 0x02000075 RID: 117
	public enum MorphAutoLumninousType
	{
		// Token: 0x040003C6 RID: 966
		None,
		// Token: 0x040003C7 RID: 967
		LightUp,
		// Token: 0x040003C8 RID: 968
		LightOff,
		// Token: 0x040003C9 RID: 969
		LightBlink,
		// Token: 0x040003CA RID: 970
		LightBS
	}

	// Token: 0x02000076 RID: 118
	public enum PMDBoneType
	{
		// Token: 0x040003CC RID: 972
		Rotate,
		// Token: 0x040003CD RID: 973
		RotateAndMove,
		// Token: 0x040003CE RID: 974
		IKDestination,
		// Token: 0x040003CF RID: 975
		Unknown,
		// Token: 0x040003D0 RID: 976
		UnderIK,
		// Token: 0x040003D1 RID: 977
		UnderRotate,
		// Token: 0x040003D2 RID: 978
		IKTarget,
		// Token: 0x040003D3 RID: 979
		NoDisp,
		// Token: 0x040003D4 RID: 980
		Twist,
		// Token: 0x040003D5 RID: 981
		FollowRotate
	}

	// Token: 0x02000077 RID: 119
	[Flags]
	public enum BoneAdditionalFlags
	{
		// Token: 0x040003D7 RID: 983
		None = 0,
		// Token: 0x040003D8 RID: 984
		IsKnee = 1,
		// Token: 0x040003D9 RID: 985
		BoneTypeMask = -16777216,
		// Token: 0x040003DA RID: 986
		BoneTypeRoot = -2147483648
	}

	// Token: 0x02000078 RID: 120
	[Flags]
	public enum RigidBodyAdditionalFlags
	{
		// Token: 0x040003DC RID: 988
		None = 0,
		// Token: 0x040003DD RID: 989
		IsFreezed = 1
	}

	// Token: 0x02000079 RID: 121
	[Flags]
	public enum PMXBoneFlags
	{
		// Token: 0x040003DF RID: 991
		None = 0,
		// Token: 0x040003E0 RID: 992
		Destination = 1,
		// Token: 0x040003E1 RID: 993
		Rotate = 2,
		// Token: 0x040003E2 RID: 994
		Translate = 4,
		// Token: 0x040003E3 RID: 995
		Visible = 8,
		// Token: 0x040003E4 RID: 996
		Controllable = 16,
		// Token: 0x040003E5 RID: 997
		IK = 32,
		// Token: 0x040003E6 RID: 998
		IKChild = 64,
		// Token: 0x040003E7 RID: 999
		InherenceLocal = 128,
		// Token: 0x040003E8 RID: 1000
		InherenceRotate = 256,
		// Token: 0x040003E9 RID: 1001
		InherenceTranslate = 512,
		// Token: 0x040003EA RID: 1002
		FixedAxis = 1024,
		// Token: 0x040003EB RID: 1003
		LocalAxis = 2048,
		// Token: 0x040003EC RID: 1004
		TransformAfterPhysics = 4096,
		// Token: 0x040003ED RID: 1005
		TransformExternalParent = 8192
	}

	// Token: 0x0200007A RID: 122
	[Flags]
	public enum ModelAdditionalFlags
	{
		// Token: 0x040003EF RID: 1007
		None = 0,
		// Token: 0x040003F0 RID: 1008
		MorphTranslateName = 1
	}

	// Token: 0x0200007B RID: 123
	[Flags]
	public enum IKAdditionalFlags
	{

	}

	// Token: 0x0200007C RID: 124
	[Flags]
	public enum IKLinkFlags
	{
		// Token: 0x040003F3 RID: 1011
		None = 0,
		// Token: 0x040003F4 RID: 1012
		HasAngleJoint = 1
	}

	// Token: 0x0200007D RID: 125
	[Flags]
	public enum PMXBoneFlag
	{
		// Token: 0x040003F6 RID: 1014
		None = 0,
		// Token: 0x040003F7 RID: 1015
		Destination = 1,
		// Token: 0x040003F8 RID: 1016
		Rotate = 2,
		// Token: 0x040003F9 RID: 1017
		Translate = 4,
		// Token: 0x040003FA RID: 1018
		Visible = 8,
		// Token: 0x040003FB RID: 1019
		Controllable = 16,
		// Token: 0x040003FC RID: 1020
		IK = 32,
		// Token: 0x040003FD RID: 1021
		IKChild = 64,
		// Token: 0x040003FE RID: 1022
		InherenceLocal = 128,
		// Token: 0x040003FF RID: 1023
		InherenceRotate = 256,
		// Token: 0x04000400 RID: 1024
		InherenceTranslate = 512,
		// Token: 0x04000401 RID: 1025
		FixedAxis = 1024,
		// Token: 0x04000402 RID: 1026
		LocalAxis = 2048,
		// Token: 0x04000403 RID: 1027
		TransformAfterPhysics = 4096,
		// Token: 0x04000404 RID: 1028
		TransformExternalParent = 8192
	}

	// Token: 0x0200007E RID: 126
	[Flags]
	public enum MeshFlags
	{
		// Token: 0x04000406 RID: 1030
		None = 0,
		// Token: 0x04000407 RID: 1031
		BlendShapes = 1,
		// Token: 0x04000408 RID: 1032
		VertexMorph = 2,
		// Token: 0x04000409 RID: 1033
		XDEF = 4
	}

	// Token: 0x0200007F RID: 127
	[Serializable]
	public class BoneData
	{
		// Token: 0x17000066 RID: 102
		// (get) Token: 0x06000307 RID: 775 RVA: 0x00019317 File Offset: 0x00017517
		public bool isKnee
		{
			get
			{
				return (this.boneAdditionalFlags & MMD4MecanimData.BoneAdditionalFlags.IsKnee) != MMD4MecanimData.BoneAdditionalFlags.None;
			}
		}

		// Token: 0x17000067 RID: 103
		// (get) Token: 0x06000308 RID: 776 RVA: 0x00019327 File Offset: 0x00017527
		public bool isRootBone
		{
			get
			{
				return (this.boneAdditionalFlags & MMD4MecanimData.BoneAdditionalFlags.BoneTypeMask) == MMD4MecanimData.BoneAdditionalFlags.BoneTypeRoot;
			}
		}

		// Token: 0x0400040A RID: 1034
		public MMD4MecanimData.BoneAdditionalFlags boneAdditionalFlags;

		// Token: 0x0400040B RID: 1035
		public string nameJp;

		// Token: 0x0400040C RID: 1036
		public string skeletonName;

		// Token: 0x0400040D RID: 1037
		public int parentBoneID;

		// Token: 0x0400040E RID: 1038
		public int sortedBoneID;

		// Token: 0x0400040F RID: 1039
		public int originalParentBoneID;

		// Token: 0x04000410 RID: 1040
		public int originalSortedBoneID;

		// Token: 0x04000411 RID: 1041
		public Vector3 baseOrigin;

		// Token: 0x04000412 RID: 1042
		public MMD4MecanimData.PMDBoneType pmdBoneType;

		// Token: 0x04000413 RID: 1043
		public int childBoneID;

		// Token: 0x04000414 RID: 1044
		public int targetBoneID;

		// Token: 0x04000415 RID: 1045
		public float followCoef;

		// Token: 0x04000416 RID: 1046
		public int transformLayerID;

		// Token: 0x04000417 RID: 1047
		public MMD4MecanimData.PMXBoneFlags pmxBoneFlags;

		// Token: 0x04000418 RID: 1048
		public int inherenceParentBoneID;

		// Token: 0x04000419 RID: 1049
		public float inherenceWeight;

		// Token: 0x0400041A RID: 1050
		public int externalID;
	}

	// Token: 0x02000080 RID: 128
	[Serializable]
	public class IKLinkData
	{
		// Token: 0x17000068 RID: 104
		// (get) Token: 0x0600030A RID: 778 RVA: 0x0001933C File Offset: 0x0001753C
		public bool hasAngleJoint
		{
			get
			{
				return (this.ikLinkFlags & MMD4MecanimData.IKLinkFlags.HasAngleJoint) != MMD4MecanimData.IKLinkFlags.None;
			}
		}

		// Token: 0x0400041B RID: 1051
		public int ikLinkBoneID;

		// Token: 0x0400041C RID: 1052
		public MMD4MecanimData.IKLinkFlags ikLinkFlags;

		// Token: 0x0400041D RID: 1053
		public Vector3 lowerLimit;

		// Token: 0x0400041E RID: 1054
		public Vector3 upperLimit;

		// Token: 0x0400041F RID: 1055
		public Vector3 lowerLimitAsDegree;

		// Token: 0x04000420 RID: 1056
		public Vector3 upperLimitAsDegree;
	}

	// Token: 0x02000081 RID: 129
	[Serializable]
	public class IKData
	{
		// Token: 0x04000421 RID: 1057
		public MMD4MecanimData.IKAdditionalFlags ikAdditionalFlags;

		// Token: 0x04000422 RID: 1058
		public int destBoneID;

		// Token: 0x04000423 RID: 1059
		public int targetBoneID;

		// Token: 0x04000424 RID: 1060
		public int iteration;

		// Token: 0x04000425 RID: 1061
		public float angleConstraint;

		// Token: 0x04000426 RID: 1062
		public MMD4MecanimData.IKLinkData[] ikLinkDataList;
	}

	// Token: 0x02000082 RID: 130
	[Serializable]
	public class RigidBodyData
	{
		// Token: 0x17000069 RID: 105
		// (get) Token: 0x0600030D RID: 781 RVA: 0x0001934C File Offset: 0x0001754C
		public bool isFreezed
		{
			get
			{
				return (this.rigidBodyAdditionalFlags & MMD4MecanimData.RigidBodyAdditionalFlags.IsFreezed) != MMD4MecanimData.RigidBodyAdditionalFlags.None;
			}
		}

		// Token: 0x04000427 RID: 1063
		public MMD4MecanimData.RigidBodyAdditionalFlags rigidBodyAdditionalFlags;

		// Token: 0x04000428 RID: 1064
		public string nameJp;

		// Token: 0x04000429 RID: 1065
		public string nameEn;

		// Token: 0x0400042A RID: 1066
		public int boneID;

		// Token: 0x0400042B RID: 1067
		public int collisionGroupID;

		// Token: 0x0400042C RID: 1068
		public int collisionMask;

		// Token: 0x0400042D RID: 1069
		public MMD4MecanimData.ShapeType shapeType;

		// Token: 0x0400042E RID: 1070
		public MMD4MecanimData.RigidBodyType rigidBodyType;

		// Token: 0x0400042F RID: 1071
		public Vector3 shapeSize;

		// Token: 0x04000430 RID: 1072
		public Vector3 position;

		// Token: 0x04000431 RID: 1073
		public Vector3 rotation;

		// Token: 0x04000432 RID: 1074
		public float mass;

		// Token: 0x04000433 RID: 1075
		public float linearDamping;

		// Token: 0x04000434 RID: 1076
		public float angularDamping;

		// Token: 0x04000435 RID: 1077
		public float restitution;

		// Token: 0x04000436 RID: 1078
		public float friction;
	}

	// Token: 0x02000083 RID: 131
	[Serializable]
	public class JointData
	{
		// Token: 0x04000437 RID: 1079
		public int rigidBodyIDA;

		// Token: 0x04000438 RID: 1080
		public int rigidBodyIDB;
	}

	// Token: 0x02000084 RID: 132
	public enum MorphMaterialOperation
	{
		// Token: 0x0400043A RID: 1082
		Multiply,
		// Token: 0x0400043B RID: 1083
		Adding
	}

	// Token: 0x02000085 RID: 133
	public struct MorphMaterialData
	{
		// Token: 0x0400043C RID: 1084
		public int materialID;

		// Token: 0x0400043D RID: 1085
		public MMD4MecanimData.MorphMaterialOperation operation;

		// Token: 0x0400043E RID: 1086
		public Color diffuse;

		// Token: 0x0400043F RID: 1087
		public Color specular;

		// Token: 0x04000440 RID: 1088
		public float shininess;

		// Token: 0x04000441 RID: 1089
		public Color ambient;

		// Token: 0x04000442 RID: 1090
		public Color edgeColor;

		// Token: 0x04000443 RID: 1091
		public float edgeScale;

		// Token: 0x04000444 RID: 1092
		public float edgeSize;

		// Token: 0x04000445 RID: 1093
		public Color textureColor;

		// Token: 0x04000446 RID: 1094
		public Color sphereColor;

		// Token: 0x04000447 RID: 1095
		public Color toonTextureColor;

		// Token: 0x04000448 RID: 1096
		public float alPower;
	}

	// Token: 0x02000086 RID: 134
	[Serializable]
	public class MorphData
	{
		// Token: 0x04000449 RID: 1097
		public string nameJp;

		// Token: 0x0400044A RID: 1098
		public string nameEn;

		// Token: 0x0400044B RID: 1099
		public string translatedName;

		// Token: 0x0400044C RID: 1100
		public MMD4MecanimData.MorphCategory morphCategory;

		// Token: 0x0400044D RID: 1101
		public MMD4MecanimData.MorphType morphType;

		// Token: 0x0400044E RID: 1102
		[NonSerialized]
		public bool isMorphBaseVertex;

		// Token: 0x0400044F RID: 1103
		[NonSerialized]
		public int[] indices;

		// Token: 0x04000450 RID: 1104
		[NonSerialized]
		public float[] weights;

		// Token: 0x04000451 RID: 1105
		[NonSerialized]
		public Vector3[] positions;

		// Token: 0x04000452 RID: 1106
		[NonSerialized]
		public MMD4MecanimData.MorphMaterialData[] materialData;
	}

	// Token: 0x02000087 RID: 135
	public class ModelData
	{
		// Token: 0x1700006A RID: 106
		// (get) Token: 0x06000311 RID: 785 RVA: 0x0001935C File Offset: 0x0001755C
		public Dictionary<string, int> morphDataDictionary
		{
			get
			{
				return this.morphDataDictionaryJp;
			}
		}

		// Token: 0x1700006B RID: 107
		// (get) Token: 0x06000312 RID: 786 RVA: 0x00019364 File Offset: 0x00017564
		public bool isMorphTranslateName
		{
			get
			{
				return (this.modelAdditionalFlags & MMD4MecanimData.ModelAdditionalFlags.MorphTranslateName) != MMD4MecanimData.ModelAdditionalFlags.None;
			}
		}

		// Token: 0x06000313 RID: 787 RVA: 0x00019374 File Offset: 0x00017574
		public int GetMorphDataIndex(string morphName, bool isStartsWith)
		{
			return this.GetMorphDataIndexJp(morphName, isStartsWith);
		}

		// Token: 0x06000314 RID: 788 RVA: 0x00019380 File Offset: 0x00017580
		public int GetMorphDataIndexJp(string morphName, bool isStartsWith)
		{
			if (morphName != null && this.morphDataList != null && this.morphDataDictionaryJp != null && this.morphDataDictionaryJp.Count > 0)
			{
				int result = 0;
				if (this.morphDataDictionaryJp.TryGetValue(morphName, out result))
				{
					return result;
				}
				if (isStartsWith)
				{
					for (int i = 0; i < this.morphDataList.Length; i++)
					{
						if (this.morphDataList[i].nameJp != null && this.morphDataList[i].nameJp.StartsWith(morphName))
						{
							return i;
						}
					}
				}
			}
			return -1;
		}

		// Token: 0x06000315 RID: 789 RVA: 0x00019420 File Offset: 0x00017620
		public int GetMorphDataIndexEn(string morphName, bool isStartsWith)
		{
			if (morphName != null && this.morphDataList != null && this.morphDataDictionaryEn != null && this.morphDataDictionaryEn.Count > 0)
			{
				int result = 0;
				if (this.morphDataDictionaryEn.TryGetValue(morphName, out result))
				{
					return result;
				}
				if (isStartsWith)
				{
					for (int i = 0; i < this.morphDataList.Length; i++)
					{
						if (this.morphDataList[i].nameEn != null && this.morphDataList[i].nameEn.StartsWith(morphName))
						{
							return i;
						}
					}
				}
			}
			return -1;
		}

		// Token: 0x06000316 RID: 790 RVA: 0x000194C0 File Offset: 0x000176C0
		public int GetTranslatedMorphDataIndex(string morphName, bool isStartsWith)
		{
			if (morphName != null && this.morphDataList != null && this.translatedMorphDataDictionary != null && this.translatedMorphDataDictionary.Count > 0)
			{
				int result = 0;
				if (this.translatedMorphDataDictionary.TryGetValue(morphName, out result))
				{
					return result;
				}
				if (isStartsWith)
				{
					for (int i = 0; i < this.morphDataList.Length; i++)
					{
						if (this.morphDataList[i].translatedName != null && this.morphDataList[i].translatedName.StartsWith(morphName))
						{
							return i;
						}
					}
				}
			}
			return -1;
		}

		// Token: 0x06000317 RID: 791 RVA: 0x00019560 File Offset: 0x00017760
		public MMD4MecanimData.MorphData GetMorphData(string morphName, bool isStartsWith)
		{
			int morphDataIndex = this.GetMorphDataIndex(morphName, isStartsWith);
			if (morphDataIndex != -1)
			{
				return this.morphDataList[morphDataIndex];
			}
			return null;
		}

		// Token: 0x06000318 RID: 792 RVA: 0x00019587 File Offset: 0x00017787
		public MMD4MecanimData.MorphData GetMorphData(string morphName)
		{
			return this.GetMorphData(morphName, false);
		}

		// Token: 0x04000453 RID: 1107
		public MMD4MecanimData.FileType fileType;

		// Token: 0x04000454 RID: 1108
		public MMD4MecanimData.ModelAdditionalFlags modelAdditionalFlags;

		// Token: 0x04000455 RID: 1109
		public int vertexCount;

		// Token: 0x04000456 RID: 1110
		public float vertexScale;

		// Token: 0x04000457 RID: 1111
		public float importScale;

		// Token: 0x04000458 RID: 1112
		public MMD4MecanimData.BoneData[] boneDataList;

		// Token: 0x04000459 RID: 1113
		public Dictionary<string, int> boneDataDictionary;

		// Token: 0x0400045A RID: 1114
		public MMD4MecanimData.IKData[] ikDataList;

		// Token: 0x0400045B RID: 1115
		public MMD4MecanimData.MorphData[] morphDataList;

		// Token: 0x0400045C RID: 1116
		public Dictionary<string, int> morphDataDictionaryJp;

		// Token: 0x0400045D RID: 1117
		public Dictionary<string, int> morphDataDictionaryEn;

		// Token: 0x0400045E RID: 1118
		public Dictionary<string, int> translatedMorphDataDictionary;

		// Token: 0x0400045F RID: 1119
		public MMD4MecanimData.RigidBodyData[] rigidBodyDataList;

		// Token: 0x04000460 RID: 1120
		public MMD4MecanimData.JointData[] jointDataList;
	}

	// Token: 0x02000088 RID: 136
	[Flags]
	public enum VertexFlags
	{
		// Token: 0x04000462 RID: 1122
		None = 0,
		// Token: 0x04000463 RID: 1123
		NoEdge = 1
	}

	// Token: 0x02000089 RID: 137
	public struct VertexData
	{
		// Token: 0x04000464 RID: 1124
		public MMD4MecanimData.VertexFlags flags;

		// Token: 0x04000465 RID: 1125
		public Vector3 position;

		// Token: 0x04000466 RID: 1126
		public Vector3 normal;

		// Token: 0x04000467 RID: 1127
		public Vector2 uv;

		// Token: 0x04000468 RID: 1128
		public float edgeScale;

		// Token: 0x04000469 RID: 1129
		public MMD4MecanimData.BoneTransform boneTransform;

		// Token: 0x0400046A RID: 1130
		public BoneWeight boneWeight;

		// Token: 0x0400046B RID: 1131
		public Vector3 sdefC;

		// Token: 0x0400046C RID: 1132
		public Vector3 sdefR0;

		// Token: 0x0400046D RID: 1133
		public Vector3 sdefR1;
	}

	// Token: 0x0200008A RID: 138
	public class ExtraData
	{
		// Token: 0x0400046E RID: 1134
		public int vertexCount;

		// Token: 0x0400046F RID: 1135
		public float vertexScale;

		// Token: 0x04000470 RID: 1136
		public float importScale;

		// Token: 0x04000471 RID: 1137
		public MMD4MecanimData.VertexData[] vertexDataList;
	}

	// Token: 0x0200008B RID: 139
	[Flags]
	public enum MorphMotionAdditionalFlags
	{
		// Token: 0x04000473 RID: 1139
		None = 0,
		// Token: 0x04000474 RID: 1140
		NameIsFull = 1
	}

	// Token: 0x0200008C RID: 140
	public class MorphMotionData
	{
		// Token: 0x1700006C RID: 108
		// (get) Token: 0x0600031B RID: 795 RVA: 0x00019591 File Offset: 0x00017791
		public bool nameIsFull
		{
			get
			{
				return (this.morphMotionAdditionalFlags & MMD4MecanimData.MorphMotionAdditionalFlags.NameIsFull) != MMD4MecanimData.MorphMotionAdditionalFlags.None;
			}
		}

		// Token: 0x04000475 RID: 1141
		public string name;

		// Token: 0x04000476 RID: 1142
		public MMD4MecanimData.MorphMotionAdditionalFlags morphMotionAdditionalFlags;

		// Token: 0x04000477 RID: 1143
		public int[] frameNos;

		// Token: 0x04000478 RID: 1144
		public float[] f_frameNos;

		// Token: 0x04000479 RID: 1145
		public float[] weights;
	}

	// Token: 0x0200008D RID: 141
	[Flags]
	public enum AnimAdditionalFlags
	{
		// Token: 0x0400047B RID: 1147
		None = 0,
		// Token: 0x0400047C RID: 1148
		SupportNameIsFull = 1
	}

	// Token: 0x0200008E RID: 142
	public class AnimData
	{
		// Token: 0x1700006D RID: 109
		// (get) Token: 0x0600031D RID: 797 RVA: 0x000195A1 File Offset: 0x000177A1
		public bool supportNameIsFull
		{
			get
			{
				return (this.animAdditionalFlags & MMD4MecanimData.AnimAdditionalFlags.SupportNameIsFull) != MMD4MecanimData.AnimAdditionalFlags.None;
			}
		}

		// Token: 0x0400047D RID: 1149
		public MMD4MecanimData.AnimAdditionalFlags animAdditionalFlags;

		// Token: 0x0400047E RID: 1150
		public int maxFrame;

		// Token: 0x0400047F RID: 1151
		public MMD4MecanimData.MorphMotionData[] morphMotionDataList;
	}
}
